浙江大学2017-18春夏《高级数据结构与算法分析》期中模拟练习
开始时间2016/01/01 08:00:00
结束时间2038/01/18 08:00:00
答题时长45分钟
考生
得分86
总分100

判断题得分:36总分:39
R1-1

To solve a problem by dynamic programming instead of recursions, the key approach is to store the results of computations for the subproblems so that we only have to compute each different subproblem once. Those solutions can be stored in an array or a hash table.

(3分)
评测结果
答案正确(3 分)

R1-2

Word stemming is to eliminate the commonly used words from the original documents.

(3分)
评测结果
答案正确(3 分)

R1-3

For the recurrence equation T(N)=aT(N/b)+f(N)T(N)=aT(N/b)+f(N), if af(N/b)=Kf(N)af(N/b)=Kf(N) for some constant K>1K>1, then T(N)=Θ(f(N))T(N)=\Theta(f(N)).

(5分)
评测结果
答案正确(5 分)

R1-4

While accessing a term, hashing is faster than search trees.

(3分)
评测结果
答案正确(3 分)

R1-5

All of the Zig, Zig-zig, and Zig-zag rotations not only move the accessed node to the root, but also roughly half the depth of most nodes on the path.

(3分)
评测结果
答案错误(0 分)

R1-6

In the 4-queens problem, (x1x_1, x2x_2, x3x_3, x4x_4) correspond to the 4 queens' column indices. During backtracking, (1, 4, 2, ?) will be checked before (1, 3, 4, ?), and none of them has any solution in their branches.

(4分)
评测结果
答案正确(4 分)

R1-7

In a B+ tree, leaves and nonleaf nodes have some key values in common.

(3分)
评测结果
答案正确(3 分)

R1-8

In a red-black tree, an internal red node cannot be a node of degree 1.

(4分)
评测结果
答案正确(4 分)

R1-9

With the same operations, the resulting skew heap is always more balanced than the leftist heap.

(3分)
评测结果
答案正确(3 分)

R1-10

Insert { 1, 2, 5, 3, 8, 4, -1, 10, 128, 34, 15, 63, 18, -24, 186 } into an initially empty binomial queue, the resulting roots are 186, -24, 15 and -1.

(5分)
评测结果
答案正确(5 分)

R1-11

For one operation, if its amortized time bound is O(logN)O(logN), then its worst-case time bound must be O(logN)O(logN).

(3分)
评测结果
答案正确(3 分)

单选题得分:30总分:36
R2-1

Among the following groups of concepts, which group is not totally relevant to a search engine?

(6分)
评测结果
答案正确(6 分)

R2-2

When solving a problem with input size NN by divide and conquer, if at each step, the problem is divided into 9 sub-problems and each size of these sub-problems is N/3N/3, and they are conquered in O(N2logN)O(N^2logN). Which one of the following is the closest to the overall time complexity?

(6分)
评测结果
答案正确(6 分)

R2-3

A B+ tree of order 3 with 21 numbers has at least __ nodes of degree 2.

(6分)
评测结果
答案错误(0 分)

R2-4

Delete the minimum number from the given leftist heap. Which one of the following statements is TRUE?

(6分)
评测结果
答案正确(6 分)

R2-5

Insert { 9, 8, 7, 2, 3, 5, 6, 4} into an initially empty AVL tree. Which one of the following statements is FALSE?

(6分)
评测结果
答案正确(6 分)

R2-6

For the result of accessing the keys 4 and 8 in order in the splay tree given in the figure, which one of the following statements is FALSE?

(6分)
评测结果
答案正确(6 分)

程序填空题得分:20总分:25
R5-1

The function BinQueue_Merge is to merge two binomial queues H1 and H2, and return H1 as the resulting queue.

BinQueue BinQueue_Merge( BinQueue H1, BinQueue H2 )
{   BinTree T1, T2, Carry = NULL;     
    int i, j;
    H1->CurrentSize += H2-> CurrentSize;
    for ( i=0, j=1; j<= H1->CurrentSize; i++, j*=2 ) {
        T1 = H1->TheTrees[i]; T2 = H2->TheTrees[i];
        switch( 4*!!Carry + 2*!!T2 + !!T1 ) { 
        case 0:
        case 1: break;    
        case 2: (5分); break;
        case 4: H1->TheTrees[i] = Carry; Carry = NULL; break;
        case 3: Carry = CombineTrees( T1, T2 );
                H1->TheTrees[i] = H2->TheTrees[i] = NULL; break;
        case 5: Carry = CombineTrees( T1, Carry );
                H1->TheTrees[i] = NULL; break;
        case 6: Carry = CombineTrees( T2, Carry );
                H2->TheTrees[i] = NULL; break;
        case 7: H1->TheTrees[i] = Carry; 
                (5分); 
                H2->TheTrees[i] = NULL; break;
        } /* end switch */
    } /* end for-loop */
    return H1;
}
评测结果
答案正确(10 分)
测试点得分
序号结果得分
0答案正确5
1答案正确5

R5-2

The function LR_Rotation is to do left-right rotation to the trouble-finder tree node T in an AVL tree.

typedef struct TNode *Tree;
struct TNode {
    int key, h;
    Tree left, right;
};

Tree LR_Rotation( Tree T )
{
    Tree K1, K2;

    K1 = T->left;    
    K2 = K1->right;
    K1->right = (5分);
    T->left = (5分);
    K2->right = T;
    (5分);
    /* Update the heights */
    K1->h = maxh(Height(K1->left), Height(K1->right)) + 1;
    T->h = maxh(Height(T->left), Height(T->right)) + 1;
    K2->h = maxh(K1->h, T->h) + 1;

    return K2;
}
评测结果
部分正确(10 分)
测试点得分
序号结果得分
0答案正确5
1答案正确5
2编译错误0